﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class UC_DatePickerUC : System.Web.UI.UserControl
{
  protected void Page_Load(object sender, EventArgs e)
  {
    //ajxCalendarDate.StartDate=DateTime.Now.Date;
    ajxCalendarDate.EndDate= DateTime.MaxValue;
    //ajxCalendarDate.SelectedDate=DateTime.Now.Date;
  }

  public DateTime? Date
  {
    get 
    {
      DateTime dt;
      if (DateTime.TryParse(txtDate.Text, out dt))
        return dt;
      else 
        return null;
    }
    set
    {
      if (value.HasValue)
        txtDate.Text = value.Value.ToString("dd/MMMM/yyyy");
    }
  }
  public bool ISRequired
  {
    get { return reqDate.Enabled; }
    set 
    { 
      reqDate.Enabled = value;      
      reqDate.Style.Add(HtmlTextWriterStyle.Display, value ? "inline" : "none");
      lblDateReq.Style.Add(HtmlTextWriterStyle.Display, value ? "inline" : "none");      
    }
  }
  public bool Enabled
    {
      get { return pnlDatePicker.Enabled; }
      set { pnlDatePicker.Enabled = value; }
    }
  public string WatermarkText
  {
    get { return wtrMrkDate.WatermarkText; }
    set { wtrMrkDate.WatermarkText = value; }
  }
}